<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="../js/vue.js"></script>
    <script>
        $(function () {
            var event=new Vue()
            new Vue({
                el:'#app',
                data:{
                    aaa:''
                },
                mounted(){
                    event.$on("myData",function (data) {
                        this.aaa=data.aaa
                    }.bind(this));
                },
                components:{
                    'my-component':{
                        data(){
                            return {
                                model:{aaa:'我是子组件的信息'}
                            }
                        },
                        template:"#my-component",
                        methods:{
                            send(){
                                event.$emit("myData",this.model)
                            }
                        }
                    }

                }

            })
        })
    </script>
</head>
<body>
    <div id="app">

        <my-component></my-component>
        <span>我是父组件：{{aaa}}</span>
    </div>
<template id="my-component">
    <div>
    <h1>{{model.aaa}}</h1>
    <button type="button" @click="send">按钮</button>
    </div>
</template>
</body>
</html>
